import * as PIXI from 'pixi.js'
import { useWindowSize } from '@vueuse/core'
import useMainStore from '@/store/modules/useMainStore'

const init = async () => {
  const mainStore = useMainStore()
  const app = new PIXI.Application()
  await app.init({
    width: useWindowSize().width.value,
    height: useWindowSize().height.value,
    backgroundColor: 0xffffff,
    resolution: window.devicePixelRatio || 1, //视网膜屏幕
    autoDensity: true, //抗锯齿
  })
  app.stage.interactive = true
  mainStore.setApp(app)
  return app
}
useMainStore().initApp(init)
